<template>
 <div>

     
      <table>

          <tr>
              <td>订单详情</td>
              <td>收货人</td>
              <td>金额</td>
              <td>操作</td>
          </tr>
          <tr v-for=" item in datalist">
              <td>订单详情

              </td>
              <td>{{item.uid}}</td>
              <td>{{item.price}}</td>
              <td>
                  <Button @click="comment(item.gid)">评价</Button>
              </td>
          </tr>

      </table>

 </div>
</template>

<script>
export default {
 data() {
  return {

      datalist:[]

  }
 },
 components: {

 },
 mounted() {
     this.orders();
 },

 methods: {

     comment(id){
        if (!localStorage.getItem('uid')){
            this.$router.push({'path':'/login'});

        }
        else{
            this.$router.push({'path':'/comment',query:{id:id}});
        }
     },

  	orders(){

  		//发送请求
      this.axios.get('http://localhost:8000/orders/').then((result) =>{
                console.log(result.data)
              this.datalist = result.data;
                console.log(this.datalist);
      });

  	},
 },
}
</script>
